Lamport's header overhangs the outside margin. This is done as follows.
The width of headers and footers is \headwidth
, which by default
equals the width of the text: \textwidth
. You can make the width
wider (or narrower) by redefining \headwidth
with the
\setlength
and \addtolength
commands.
To overhang the outside margin where the marginal notes are
printed, add both \marginparsep
and \marginparwidth
to
\headwidth
with the commands:
\addtolength{\headwidth}{\marginparsep} \addtolength{\headwidth}{\marginparwidth}
\pagestyle{fancy}
or \pagestyle{fancyplain}
command as this
will establish the default for \headwidth
.
And now a complete definition of Lamport's book style:
\documentclass{book} \usepackage{fancyheadings} \pagestyle{fancyplain} \addtolength{\headwidth}{\marginparsep} \addtolength{\headwidth}{\marginparwidth} \renewcommand{\chaptermark}[1]{\markboth{#1}{}} \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} \lhead[\fancyplain{}{\bfseries\thepage}] {\fancyplain{}{\bfseries\rightmark}} \rhead[\fancyplain{}{\bfseries\leftmark}] {\fancyplain{}{\bfseries\thepage}} \cfoot{}
Notice that the \chaptermark
and \sectionmark
commands have
been redefined to eliminate the chapter numbers and the uppercaseness.
For the second example, we take the / book.
Chapter pages have no headers or footers. So we declare
\thispagestyle{empty}for every chapter page, and we do not need fancyplain.
Chapter and section titles appear in the form: 2. DO IT NOW, so we have
to redefine \chaptermark
and \sectionmark
as follows (see
Section ):
\renewcommand{\chaptermark}[1]% {\markboth{\uppercase{\thechapter.\ #1}}{}} \renewcommand{\sectionmark}[1]% {\markright{\uppercase{\thesection.\ #1}}}
In an even-header, the page number is printed as the LeftHeader and the chapter info as the RightHeader; in an odd-header, the section info is printed as the LeftHeader and the page number as the RightHeader. The CenteredHeaders are empty. There are no footers.
There is a decorative line in the header. It is 0.5pt wide, so we need the commands:
\setlength{\headrulewidth}{0.5pt} \setlength{\footrulewidth}{0pt}
The font used in the headers is 9 pt bold Helvetica. The PSNFSS system
by Sebastian Rahtz uses the short (Karl Berry) name phv
for
Helvetica, so this font is selected with the commands:
\fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont(See Sections 7.6.1 and 11.9.1 of the Companion.) Let us define a shorthand for this:
\newcommand{\helv}{% \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont}
Now we are ready for the page layout:
\lhead[\helv \thepage]{\helv \rightmark} \rhead[\helv \leftmark]{\helv \thepage} \cfoot{}
Putting this all together:
\documentclass{book} \usepackage{fancyheadings} \pagestyle{fancy} \renewcommand{\chaptermark}[1]% {\markboth{\uppercase{\thechapter.\ #1}}{}} \renewcommand{\sectionmark}[1]% {\markright{\uppercase{\thesection.\ #1}}} \setlength{\headrulewidth}{0.5pt} \setlength{\footrulewidth}{0pt} \newcommand{\helv}{% \fontfamily{phv}\fontseries{b}\fontsize{9}{11}\selectfont} \lhead[\helv \thepage]{\helv \rightmark} \rhead[\helv \leftmark]{\helv \thepage} \cfoot{}